package com.alageek.study.service;

import com.alageek.study.entity.Book;
import com.alageek.study.mapper.BookMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookService {

    @Autowired
    private BookMapper bookDao;

    public int addBook(Book book){
        return bookDao.addBook(book);
    }

    public int updateBook(Book book){
        return bookDao.updateBook(book);
    }

    public int deleteBookById(Integer id){
        return bookDao.deleteBookById(id);
    }

    public Book getBookById(Integer id){
        return bookDao.getBookById(id);
    }

    public List<Book> getAllBook(){
        return bookDao.getAllBooks();
    }

}
